package com.syj.web.controller;

import com.syj.web.model.User;
import com.syj.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author rankai
 *         createTime 2017-02-2017/2/8 20:06
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping
    public String registerPage() {
        return "/register";
    }

    @PostMapping
    public String register(User user) {
        userService.insertSelective(user);
        return "/login";
    }
}
